<template>
  <div>
    <div class="list">
      <div class="item" v-for="item in resultList" :key="item.id">
          <mv-item
          :imgUrl="item.cover"
          :tilte="item.name"
          :authorList="item.artists"
          :id="item.id"
          ></mv-item>
      </div>
    </div>
  </div>
</template>

<script>
import MvItem from "@/components/MVItem";
import { searchAPI } from "@/api";
export default {
  components: { MvItem },
  name: "VideoRes",
  data() {
    return {
      resultList: [],
    };
  },
  methods: {
    async getResult() {
      const res = await searchAPI({
        keywords: this.keywords,
        type: 1004,
        limit: 100,
      });
      this.resultList = res.data.result.mvs;
    },
  },
  computed: {
    keywords() {
      return this.$store.state.search.searchWord;
    },
  },
  created() {
    this.getResult();
  },
};
</script>

<style lang="less" scoped>
.list{
  width: 95%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  .item:last-child:nth-child(3n-1){
    margin-right: 10px;
  }
}
</style>